/**
 * tasklenghtconstraint.cpp is part of %PROJECTNAME%.
 *
 * %PROJECTNAME% is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * %PROJECTNAME% is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with %PROJECTNAME%.  If not, see <http://www.gnu.org/licenses/>.
 */

#include "tasklenghtconstraint.h"
#include "../../utils/visitor/visitor.h"
#include <sstream>

const std::string TaskLenghtConstraint::TASK_LENGHT_CONSTRAINT = "Lenght";

TaskLenghtConstraint::TaskLenghtConstraint( tTime a_lenght ) :
    TaskConstraint(),
    m_lenght( a_lenght )
{
}

TaskLenghtConstraint::~TaskLenghtConstraint()
{
}

void TaskLenghtConstraint::Accept( Visitor * a_visitor )
{
    if( a_visitor )
        a_visitor->Visit( this );
}

std::string TaskLenghtConstraint::Print() const
{
    std::ostringstream strStream;
    strStream << TASK_LENGHT_CONSTRAINT << " = " << m_lenght;

    return strStream.str();
}

void TaskLenghtConstraint::Lenght( tTime a_lenght )
{
    m_lenght = a_lenght;
}

tTime TaskLenghtConstraint::Lenght() const
{
    return m_lenght;
}
